package xhwl.hmo.mall.http.api;


import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/1/16.
 */

public class AddCommentApi extends BaseApi {
    AddCommentReq req;
    public AddCommentApi(String member_mobile, String buy_id, String goods_id, String comment_level, String comment_desc, String comment_pic){
        req=new AddCommentReq(member_mobile,buy_id,goods_id,comment_level,comment_desc,comment_pic);
        setShowDialog(true);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).addComment(requestBody);
    }
    public class AddCommentReq {
        private String member_mobile;
        private String buy_id;
        private String goods_id;
        private String comment_level;
        private String comment_desc;
        private String comment_pic;

        public AddCommentReq(String member_mobile, String buy_id, String goods_id, String comment_level, String comment_desc, String comment_pic) {
            this.member_mobile = member_mobile;
            this.buy_id = buy_id;
            this.goods_id = goods_id;
            this.comment_level = comment_level;
            this.comment_desc = comment_desc;
            this.comment_pic = comment_pic;
        }
    }
}
